package com.cjb.basecouldcomsumer.consumer.controller;

import com.cjb.basecouldcomsumer.consumer.service.ConsumerService;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/consumer")
public class ConsumerController {

    @Autowired
    private ConsumerService consumerService;


    @GetMapping("/index")
    public Map consumer(HttpServletRequest request){
        Map<String, List<String>> map = consumerService.consumer();
        map.put("这是消费端消费产生的数据", Lists.newArrayList("当前的ip地址"+request.getLocalAddr(),"我是消费者","消费者对数据进行了一次性加工","consumer"));
        return map;
    }




}
